package com.xzit.headline.activity;

import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentTransaction;

import com.xzit.headline.R;
import com.xzit.headline.bean.NewListData;
import com.xzit.headline.fragment.DetailFragment;

public class DetailActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);

        //通过get获取数据对象
        NewListData.DataBean.NewsBean bean = (NewListData.DataBean.NewsBean) getIntent().getSerializableExtra("bean");


        //DetailFragment fragment = new DetailFragment();

        DetailFragment fragment = new DetailFragment(bean);


        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.replace(R.id.content, fragment);
        transaction.commit();
    }
}
